using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Leo.Entities;

namespace Leo.Repository.Mapping
{
    public class RecetaMap : EntityTypeConfiguration<Receta>
    {
        public RecetaMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Receta");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdPaciente).HasColumnName("IdPaciente");

            // Relationships
            this.HasRequired(t => t.Paciente)
                .WithMany(t => t.Recetas)
                .HasForeignKey(d => d.IdPaciente);

        }
    }
}
